package com.sheep.classroompie.util;

public class R<T> {

  /** 编码：200成功，0和其它数字为失败*/
  private Integer code;
  //返回信息
  private String msg;
  //信息返回数据
  private T data;

  public static <T> R<T> success(T object){
    R<T> r = new R<T>();
    r.data = object;
    r.code = 200;
    r.msg = "登录成功!";
    return r;
  }

  public static <T> R<T> error(String msg){
    R r = new R();
    r.msg = msg;
    r.code = 0;
    return r;
  }

  public Integer getCode() {
    return code;
  }

  public void setCode(Integer code) {
    this.code = code;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public T getData() {
    return data;
  }

  public void setData(T data) {
    this.data = data;
  }
}
